﻿#region Usings
using BK.Entities;
using Lib.Data.ORM;
#endregion

namespace BK.BL
{
    public class BlContext : MsSqlOrmDataBase
    {
        #region Readonly & Static Fields
        private static BlContext _instance;
        #endregion

        #region C'tors
        private BlContext()
        {
        }
        #endregion

        #region Instance Properties
        public Accounts Accounts
        {
            get { return (Accounts) DataManagers[typeof (AccountEntity)]; }
        }

        public Categories Categories
        {
            get { return (Categories) DataManagers[typeof (CategoryEntity)]; }
        }

        public Currencies Currencies
        {
            get { return (Currencies) DataManagers[typeof (CurrencyEntity)]; }
        }

        public Payments Payments
        {
            get { return (Payments) DataManagers[typeof (PaymentEntity)]; }
        }

        public Users Users
        {
            get { return (Users) DataManagers[typeof (UserEntity)]; }
        }

        public PaymentList PaymentList
        {
            get { return (PaymentList) DataViews[typeof(PaymentItemEntity)]; }
        }
        #endregion

        #region Class Properties
        public static BlContext Instance
        {
            get
            {
                if (_instance == null)
                    _instance = new BlContext();

                return _instance;
            }
        }
        #endregion
    }
}